package com.slwu.singleton;

public class Main {
    public static void main(String[] args) {
        Singleton s1 = Singleton.getInstance();
        Singleton s2 = Singleton.getInstance();
        if (s1 == s2) {
            System.out.println("Singleton is thread-safe");
        } else {
            System.out.println("Singleton is not thread-safe");
        }

        EagerSingleton es1 = EagerSingleton.getInstance();
        EagerSingleton es2 = EagerSingleton.getInstance();
        if (es1 == es2) {
            System.out.println("EagerSingleton is thread-safe");
        } else {
            System.out.println("EagerSingleton is not thread-safe");
        }

        LazySingleton ls1 = LazySingleton.getInstance();
        LazySingleton ls2 = LazySingleton.getInstance();
        if (ls1 == ls2) {
            System.out.println("LazySingleton is thread-safe");
        } else {
            System.out.println("LazySingleton is not thread-safe");
        }

        IoDHSingleton iodhs1 = IoDHSingleton.getInstance();
        IoDHSingleton iodhs2 = IoDHSingleton.getInstance();
        if (iodhs1 == iodhs2) {
            System.out.println("IoDHSingleton is thread-safe");
        } else {
            System.out.println("IoDHSingleton is not thread-safe");
        }

        EnumSingleton es3 = EnumSingleton.getInstance();
        EnumSingleton es4 = EnumSingleton.getInstance();
        if (es3 == es4) {
            System.out.println("EnumSingleton is thread-safe");
        } else {
            System.out.println("EnumSingleton is not thread-safe");
        }
    }
}
